package com.sun.chunqiugeneratorbasic.cli.command;


import com.sun.chunqiugeneratorbasic.generator.MainGenerator;
import com.sun.chunqiugeneratorbasic.model.MainTemplateConfig;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import picocli.CommandLine;
import java.util.concurrent.Callable;

/**
 * @author chuqniu
 */
@Data
@CommandLine.Command(name = "generate", mixinStandardHelpOptions = true)
public class GenerateCommand implements Callable<Integer> {
    @CommandLine.Option(names = {"-l", "--loop"}, description = "是否循环", arity = "0..1", interactive = true)
    private boolean loop;
    @CommandLine.Option(names = {"-a", "--author"}, description = "作者名称", arity = "0..1", interactive = true)
    private String author;
    @CommandLine.Option(names = {"-o", "--outputText"}, description = "输出文本", arity = "0..1", interactive = true)
    private String outputText;


    @Override
    public  Integer call() {
        MainTemplateConfig mainTemplateConfig = new MainTemplateConfig();
        BeanUtils.copyProperties(this, mainTemplateConfig);
        MainGenerator.doGenerator(mainTemplateConfig);
        return 0;
    }
}
